﻿using System;
using System.Web.UI.WebControls;
using Medianamik.Core;
using Medianamik.UI.Controls;

namespace Medianamik.UI.ConfigManagement
{
    public partial class DomainManagement : BaseModuleEditionPage<Domain>
    {
        protected override string ReturnURL
        {
            get
            {
                return "/medianamik/configmanagement/domainlist.aspx";
            }
        }

        public override LinkButton SaveButton
        {
            get { return btnSave; }
        }

        public override MedianamikFormTemplate MedianamikFormTemplate
        {
            get { return Fields; }
        }

        protected override string NodeIdParamName
        {
            get
            {
                return "id";
            }
        }

        public override Guid? TypeId
        {
            get
            {
                return MedianamikTypes.Domain;
            }
        }

        protected override Guid? ParentNodeId
        {
            get
            {
                return MedianamikModules.ConfigManagement;
            }
        }

        protected override void Save(object sender, EventArgs e)
        {
            if (IsValid)
            {
                NodeManager.SaveNode(MedianamikFormTemplate.GetFormValue(CurrentNode));
                Response.Redirect(ReturnURL);
            }
        }
    }
}